package com.biosimilarity.reflection.model.paratrope;

import com.biosimilarity.reflection.model.paratrope.Absyn.*;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;

/** BNFC-Generated Fold Visitor */
public abstract class FoldVisitor<R,A> implements AllVisitor<R,A> {
    public abstract R leaf(A arg);
    public abstract R combine(R x, R y, A arg);

/* ProcessExpr */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Composition p, A arg) {
      R r = leaf(arg);
      for (ProcessExpr x : p.listprocessexpr_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Reception p, A arg) {
      R r = leaf(arg);
      r = combine(p.nominal_.accept(this, arg), r, arg);
      r = combine(p.abstraction_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Transmission p, A arg) {
      R r = leaf(arg);
      r = combine(p.nominal_.accept(this, arg), r, arg);
      r = combine(p.concretion_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Transcription p, A arg) {
      R r = leaf(arg);
      r = combine(p.nominal_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Termination p, A arg) {
      R r = leaf(arg);
      return r;
    }

/* Abstraction */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Suspension p, A arg) {
      R r = leaf(arg);
      r = combine(p.formals_.accept(this, arg), r, arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }

/* Concretion */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Provision p, A arg) {
      R r = leaf(arg);
      r = combine(p.actuals_.accept(this, arg), r, arg);
      return r;
    }

/* Nominal */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.AtomLiteral p, A arg) {
      R r = leaf(arg);
      return r;
    }
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Encoding p, A arg) {
      R r = leaf(arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }

/* Formals */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Obligation p, A arg) {
      R r = leaf(arg);
      for (Nominal x : p.listnominal_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* Actuals */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Remittance p, A arg) {
      R r = leaf(arg);
      for (ProcessExprPlus x : p.listprocessexprplus_) {
        r = combine(x.accept(this,arg), r, arg);
      }
      return r;
    }

/* ProcessExprPlus */
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Value p, A arg) {
      R r = leaf(arg);
      r = combine(p.processexpr_.accept(this, arg), r, arg);
      return r;
    }
    public R visit(com.biosimilarity.reflection.model.paratrope.Absyn.Variable p, A arg) {
      R r = leaf(arg);
      r = combine(p.nominal_.accept(this, arg), r, arg);
      return r;
    }


}
